package com.vip.buycart.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.vip.buycart.bl.OrderDetailBl;
import com.vip.buycart.entity.OrderDetail;
import com.vip.common.BuycartConstant;
import com.vip.framework.generic.BaseDispatchAction;

/**
 * 与购物车相关的Action
 * 
 * @author sai
 *
 */
public class BuycartAction extends BaseDispatchAction {

	/**
	 * 购物车滚动文字
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward marquee(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		
		
		Object orderDetails = request.getSession().getAttribute(BuycartConstant.SESSION_ORDER_DETAILS);
		OrderDetailBl bl = (OrderDetailBl)getBean("orderDetailBl");
		boolean condition;
		if (null==orderDetails) {
			
			List<OrderDetail> ods = bl.getAll();
			request.getSession().setAttribute(BuycartConstant.SESSION_ORDER_DETAILS, ods);
		}
		
		return mapping.findForward("success");
	}
}
